import requests
import json
import UA模块
#设置url
url = 'http://www.kfc.com.cn/kfccda/ashx/GetStoreList.ashx?op=keyword'
#设置参数
x = input('请输入你欲查询的城市：')
data = {'cname':'','pid':'','keyword':x,'pageIndex':'1 ','pageSize':' 100',
}
#伪装UA
headers = UA模块.main()
#发起请求
response = requests.post(url=url,data=data,headers=headers)
#获取响应数据
dic_ = response.json()
#数据存储
filename = x +'kfc店铺信息.json'
fp = open(filename,'w',encoding='utf-8')
json.dump(dic_,fp=fp,ensure_ascii=False)
print('爬取完成！！！')